using abilities.parameters;

namespace abilities.triggers
{
    public class AbilityTriggerOnHealthChanged : AbilityTrigger
    {
        public override void Start()
        {
            UnitObject owner = context.AbilityManager.Owner;
            owner.Parameter.ParamChangedSignal.AddListener(ParameterEntry.HEALTH,onHealthChanged);
        }

        public override void Stop()
        {
            UnitObject owner = context.AbilityManager.Owner;
            owner.Parameter.ParamChangedSignal.RemoveListener(onHealthChanged);
        }

        void onHealthChanged(ParameterEntry parameterEntry,ParameterValue parameterValue)
        {
            OnPerform();
        }
    }
}